﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace Vision.VisionWorkshop.Common
{
	internal class GreaterThanVisibilityConverter : IValueConverter
	{
		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			int gt = 1;
			int ivalue = 0;

			if (parameter != null)
			{
				int.TryParse(parameter.ToString(), out gt);
			}

			if (value != null && int.TryParse(value.ToString(), out ivalue))
			{
				if (ivalue > gt)
					return Visibility.Visible;
				else
					return Visibility.Collapsed;
			}
			else
				return value;
		}

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			return value;
		}
	}
}
